package com.jt.provider.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ProviderLogController {
    /**org.slf4j.logger 是一组日志API规范,
     * 作者推出这个组规范最主要的目的是(挟天子以令诸侯),
     * 希望让这组接口成为日志门面对象,
     * 项目中所有日志相关的API都使用
     * import org.slf4j.Logger;
     * import org.slf4j.LoggerFactory;
     * */
  public static Logger log=
          LoggerFactory.getLogger(ProviderController.class);
   @GetMapping("/provider/log/doLog01")
    public String doLog01(){//日志级别trace<debug<info<warn<error
       System.out.println("==doLog01==");
       log.trace("===trace===");
       log.debug("===debug===");
       log.info("===info====");
       log.warn("===warn===");
       log.error("===error===");
       return "log config test";
   }
   @Value("${logging.level.com.jt:info}")
    private String logLevel;
   @GetMapping("/provider/log/doLog02")
    public String doLog02(){
       log.debug("===debug===");
       log.info("===info====");
       log.warn("===warn===");
       log.error("===error===");
       return "log level is"+logLevel;
   }
}
